package com.common.jump;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.curry.android.util.IntentHelper;
import com.orangelife.mobile.constants.Constant;
import com.orangelife.mobile.pay.activity.UsersPaidActivity;
import com.orangelife.mobile.pay.biz.PaymentModule;
import com.orangelife.mobile.property.activity.PropertyBillDetailActivity;
import com.orangelife.mobile.property.activity.PropertyBillHistoryDetailActivity;
import com.orangelife.mobile.property.activity.PropertyBillHouseListActivity;
import com.orangelife.mobile.propertyOld.activity.PropertyBillDetailOldActivity;
import com.orangelife.mobile.propertyOld.activity.PropertyBillListOldActivity;
import com.orangelife.mobile.voucher.activity.VoucherListSelectActivity;
import com.orangelife.mobile.confirmOrder.biz.MerchantOrderListHelper;

import java.util.ArrayList;
import java.util.Map;

/**
 * 跳转公共类
 * Created by zv on 2016/2/24.
 */
public class JumpManager {
    /** 跳转到地址界面的结果码 */
    public static int RESULT_CODE_VOUCHER_LIST = 1;
    /** 跳转到地址界面的结果码 */
    public static int RESULT_CODE_ADDRESS = 2;
    /** 跳转到备注界面的结果码 */
    public static int RESULT_CODE_REMARK = 3;

    public static void jumpToVoucherListWithGood(Activity activity, int type, String merID, String goodID, String totalCost) {
        Bundle bundle = new Bundle();
        bundle.putInt(MerchantOrderListHelper.TYPE, type);
        bundle.putString(MerchantOrderListHelper.MER_ID, merID);
        bundle.putString(MerchantOrderListHelper.GOOD_ID, goodID);
        bundle.putString(MerchantOrderListHelper.TOTAL_COST, totalCost);
        Intent intent = new Intent(activity, VoucherListSelectActivity.class);
        intent.putExtras(bundle);
        activity.startActivityForResult(intent, 2);
        IntentHelper.getInstances().jumpActivityAnimation(activity,false);
    }

    /** 跳转到抵用券列表，从多商户列表中 */
    public static void jumpToVoucherListWithMerchant(Activity activity, String merID, String totalCost, String goodsID, int requestCode) {
        jumpToVoucherList(activity, merID, totalCost, goodsID, requestCode);
    }

    /** 跳转到抵用券列表 */
    public static void jumpToVoucherList(Activity activity, String merID, String totalCost, String goodsID, int requestCode) {
        Bundle bundle = new Bundle();
        bundle.putInt(MerchantOrderListHelper.TYPE, 1);
        bundle.putString(MerchantOrderListHelper.MER_ID, merID);
        bundle.putString(MerchantOrderListHelper.TOTAL_COST, totalCost);
        bundle.putString(MerchantOrderListHelper.GOOD_ID, goodsID);
        Intent intent = new Intent(activity, VoucherListSelectActivity.class);
        intent.putExtras(bundle);
        activity.startActivityForResult(intent, requestCode);
        IntentHelper.getInstances().jumpActivityAnimation(activity,false);
    }

    /** 选择房屋按钮直接查询详情"1",列表跳物业缴费详情"0" */
    public static void jumpToPropertyFeeDetail(String commID, String apartmentID, String type, Context context) {
        Bundle bundle = new Bundle();
        bundle.putString("commID", commID);
        bundle.putString("apartmentID", apartmentID);
        bundle.putString("type", type);
        IntentHelper.getInstances().bundleWithExtra(context, PropertyBillDetailActivity.class, bundle);
    }

    /** 旧的物业缴费，账单和历史是一个界面（旧的历史，只是账单的一个部分，不存在独立个体） */
    public static void jumpToOldProperty(Context context, String commID, String apartmentID) {
        Bundle bundle = new Bundle();
        bundle.putString("commID", commID);
        bundle.putString("apartmentID", apartmentID);
        IntentHelper.getInstances().bundleWithExtra(context, PropertyBillListOldActivity.class, bundle, null, Intent.FLAG_ACTIVITY_NEW_TASK, -1);
    }

    public static void jumpToPropertyHistoryDetail(Context context, String commID, String apartmentID, String payBillID) {
        Bundle bundle = new Bundle();
        bundle.putString("commID", commID);
        bundle.putString("apartmentID", apartmentID);
        bundle.putString("payBillID", payBillID);
        IntentHelper.getInstances().bundleWithExtra(context, PropertyBillHistoryDetailActivity.class, bundle);
    }

    public static void jumpToOldPropertyHistoryDetail(Context context, String orderID, String commID) {
        Bundle bundle = new Bundle();
        bundle.putString("orderID", String.valueOf(orderID));
        bundle.putString("commID", String.valueOf(commID));
        IntentHelper.getInstances().bundleWithExtra(context, PropertyBillDetailOldActivity.class, bundle);
    }

}
